package com.elitesland.org.repo;

import com.elitesland.org.entity.OrgAddressBookDO;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.querydsl.QuerydslPredicateExecutor;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Optional;

@Repository
public interface OrgAddressBookRepo extends JpaRepository<OrgAddressBookDO, Long>, QuerydslPredicateExecutor<OrgAddressBookDO> {

    List<OrgAddressBookDO> findAllByRecordIdAndAddressType(Long id, String type);

    List<OrgAddressBookDO> findAllByIdIn(List<Long> ids);

    void deleteAllByIdIn(List<Long> ids);

    OrgAddressBookDO findByBankNameAndBankAccount(String bankName,String bankAccount );
    Optional<OrgAddressBookDO> findByBankAccount(String bankAccount);
    OrgAddressBookDO findByRecordIdAndIsPrimary(Long id,Boolean flag);
}
